﻿using System;
using GC_RF.Domain.Abstractions.Interfaces.Helpers;
using GC_RF.Domain.Enums;
using NLog;

namespace GC_RF.Domain.Helpers
{
	public class NLogLogger : ILogger
	{
		#region Variables

		private readonly Logger _logger;

		#endregion

		#region Constructors

		public NLogLogger()
		{
			_logger = LogManager.GetCurrentClassLogger();
		}

		#endregion

		#region ILogger Members

		public void LoggingMessage(string message, MessageType messageType)
		{
			switch (messageType)
			{
				case MessageType.Info:
					_logger.Trace(message);
					break;

				case MessageType.Trace:
					_logger.Trace(message);
					break;

				case MessageType.Warning:
					_logger.Warn(message);
					break;

				default:
					throw new NotImplementedException(string.Format("not implemented message type"));
			}
		}

		public void LoggingExceptionMessage(Exception exception)
		{
			_logger.ErrorException(exception.Message, exception);
		}

		#endregion
	}
}
